package router

import (
	"github.com/gin-contrib/cors"
	"github.com/gin-gonic/gin"
	"novel-mng/handlers"
)

func Init() *gin.Engine {
	r := gin.Default()
	r.Use(cors.Default())
	r.Static("static", "./static")
	//r.GET("/test", handlers.Test)
	//r.POST("/login", handlers.Login)
	//r.GET("/list", handlers.List)
	//r.GET("/detail", handlers.Detail)
	r.POST("/login", handlers.UserLogin)
	r.POST("/RoleAddNode", handlers.RoleAddNode)
	r.GET("/userRole", handlers.UserRole)
	r.GET("/roleNode", handlers.RoleNode)
	r.POST("/carAdd", handlers.CarAdd)
	r.POST("/orderAdd", handlers.OrderAdd)
	r.GET("/orderList", handlers.OrderList)
	r.GET("/orderDetail", handlers.OrderDetail)
	return r
}
